package com.itheima.tilas.controller;

import com.itheima.tilas.Utils.ResultUtil;
import com.itheima.tilas.entity.Dept;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试ioc与di
 * @author 132
 */
@Slf4j
@RestController
@RequestMapping("ioc_di")
public class TestIOCAndController {

    @Autowired
    Dept dept;
    @GetMapping("/dept")
    public ResultUtil createDeptByIoc(){
        //使用springBoot ioc 自动创建一个对象
        log.info("自动创建的对象{}",dept);
        return ResultUtil.success();
    }
}
